//
//  TTGoodsDetailInfoView.m
//  TaoTuo
//
//  Created by LG on 2020/11/15.
//  Copyright © 2020 刘广. All rights reserved.
//

#import "TTGoodsDetailInfoView.h"
#import <UIView+TYAlertView.h>
#import "TTBaozhangView.h"
#import "TTGoodsDetailParamsView.h"

@interface TTGoodsDetailInfoView ()
/// 现货、定制
@property (weak, nonatomic) IBOutlet UILabel *goodsTypeLabel;
/// 现货件数
@property (weak, nonatomic) IBOutlet UILabel *xianhuoCountLabel;
/// 参数
@property (weak, nonatomic) IBOutlet UILabel *paramsLabel;

@property (nonatomic, strong) TTBaozhangView *bzView;

@property (nonatomic, strong) TTGoodsDetailParamsView *paramsView;

@end

@implementation TTGoodsDetailInfoView

- (void)awakeFromNib
{
    [super awakeFromNib];
    
    
}

- (void)setModel:(TTDetailModel *)model
{
    _model = model;
    
    
    if (model.isExistingGoods) {
        // 现货
        self.goodsTypeLabel.text = @"现货货品";
        self.xianhuoCountLabel.text = [NSString stringWithFormat:@"%@件", model.StockNumber];
        self.xianhuoCountLabel.textColor = UIColorHex(999999);
    }
    
    if (model.isCustomGoods) {
        // 定制
        self.goodsTypeLabel.text = @"高端定制";
        self.xianhuoCountLabel.text = @"开始定制";
        self.xianhuoCountLabel.textColor = UIColorHex(#8B57E6);
        
    }
    
    
    
}

// 选择 现货 或 定制
- (IBAction)chooseBtnClick:(id)sender {
    
    [[NSNotificationCenter defaultCenter] postNotificationName:@"clickExistingOrCustomGoodsNotify_key" object:nil];
}

// 保障
- (IBAction)safeguardBtnClick:(id)sender {
    
    [self.bzView show];
}

// 参数
- (IBAction)paramsBtnClick:(id)sender {
    
    self.paramsView.model = self.model;
    [self.paramsView show];
    
}


- (TTBaozhangView *)bzView
{
    if (!_bzView) {
        _bzView = [[TTBaozhangView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 532)];
    }
    return _bzView;
}

- (TTGoodsDetailParamsView *)paramsView
{
    if (!_paramsView) {
        _paramsView = [[TTGoodsDetailParamsView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 532)];
    }
    return _paramsView;
}


@end
